struct Solution;

impl Solution {
    pub fn int_to_roman(num: i32) -> String {
        let roman_alpha = [
            "M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I",
        ];
        let roman_value = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1];
        let mut index = 0;
        let mut result: String = "".into();
        while num > 0 {
            if num > roman_value[index] {
                result += roman_alpha[index];
                num -= roman_value[index];
            } else {
                index += 1;
            }
        }
        result
    }
}
